package com.quiz.bis.enums;

import lombok.Getter;

/**
 * 考试状态枚举
 */
@Getter
public enum ExamStatusEnum {
    DRAFT(0, "草稿"),
    PUBLISHED(1, "已发布"),
    IN_PROGRESS(2, "进行中"),
    FINISHED(3, "已结束"),
    ARCHIVED(4, "已归档");

    private final Integer code;
    private final String name;

    ExamStatusEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public static String getNameByCode(Integer code) {
        for (ExamStatusEnum value : values()) {
            if (value.getCode().equals(code)) {
                return value.getName();
            }
        }
        return "";
    }
}